home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / System7 tools / Frontier / Frontier SDK 2.1 / Toolkits / IAC Tools / iacshort.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-09  |  1.6 KB  |  74 lines  |  [TEXT/KAHL]

  1.  
  2. /*© Copyright 1988-1993 UserLand Software, Inc.  All Rights Reserved.*/
  3.  
  4. #include "iacinternal.h"
  5.  
  6.  
  7. Boolean IACpushshortparam (short val, OSType keyword) {
  8.     
  9.     return (IACpushshortitem (IACglobals.event, val, keyword));
  10.     } /*IACpushshortparam*/
  11.  
  12.  
  13. Boolean IACreturnshort (short x) {
  14.     
  15.     return (IACpushshortitem (IACglobals.reply, x, keyDirectObject));
  16.     } /*IACreturnshort*/
  17.  
  18.  
  19. Boolean IACgetshortparam (OSType keyword, short *val) {
  20.     
  21.     if (!IACgetshortitem (IACglobals.event, keyword, val)) {
  22.         IACparamerror (IACglobals.errorcode, "\pshort", keyword);
  23.         
  24.         return (false);
  25.         }
  26.     
  27.     IACglobals.nextparamoptional = false; /*must be reset for each param*/
  28.     
  29.     return (true);
  30.     } /*IACgetshortparam*/
  31.     
  32.     
  33. Boolean IACgetshortitem (AEDescList *list, long n, short *val) {
  34.     
  35.     register OSErr ec;
  36.     DescType key;
  37.     DescType typeCode;
  38.     Size actualSize;
  39.     
  40.     if ((*list).descriptorType != typeAEList) {
  41.     
  42.         ec = AEGetKeyPtr (list, n, typeShortInteger, &typeCode, (Ptr)val,
  43.                           sizeof (*val), &actualSize);
  44.                           
  45.         if (ec != errAEDescNotFound)
  46.             goto done;
  47.         }
  48.  
  49.     ec = AEGetNthPtr (list, n, typeShortInteger, &key, &typeCode, (Ptr) val, sizeof (*val), &actualSize);
  50.     
  51.     done:
  52.     
  53.     IACglobals.errorcode = ec;
  54.     
  55.     return (ec == noErr);
  56.     } /*IACgetshortitem*/
  57.  
  58.  
  59. Boolean IACpushshortitem (AEDescList *list, short val, long n) {
  60.     
  61.     register OSErr ec;
  62.  
  63.     if ((*list).descriptorType != typeAEList)
  64.         ec = AEPutKeyPtr (list, n, typeShortInteger, (Ptr)&val, sizeof (val));
  65.     else
  66.         ec = AEPutPtr (list, n, typeShortInteger, (Ptr)&val, sizeof (val));
  67.     
  68.     IACglobals.errorcode = ec;
  69.     
  70.     return (ec == noErr);
  71.     } /*IACpushshortitem*/
  72.  
  73.  
  74.